import request from "../utils/request";


export const addRepairService = (addRepairData) => {
    // console.log(addRepairData)
    const params = new URLSearchParams()
    for(let key in addRepairData){
        params.append(key,addRepairData[key])
    }
    return request.post("/repair/addRepair",params)
}

export const deleteRepairService = (id) => {
    const params = new URLSearchParams()
    params.append("id",id)
    return request.put('/repair/deleteRepair',params)
}

export const getAllRepairService = () => {
    return request.get('/repair/getAllRepair')
}

export const passRepairService = (passRepairData) => {
    const params = new URLSearchParams()
    for(let key in passRepairData){
        params.append(key,passRepairData[key])
    }
    return request.put('/repair/passRepair',params)
}

export const finishRepairService = (id) => {
    const params = new URLSearchParams()
    params.append("id",id)
    return request.put('/repair/finishRepair',params)
}

export const getByRoomNumberService = (roomNumber) => {
    const params={'roomNumber':roomNumber}
    return request.get('/repair/getByRoomNumber',{params:params})
}

export const getByWorkerIdService = (workerId) => {
    const params={'workerId':workerId}
    return request.get('/repair/getByWorkerId',{params:params})
}